//
//  CustomPromptView.m
//  
//
//  Created by limaohuyu on 2020/7/13.
//  Copyright © 2020 czw. All rights reserved.
//

#import "CustomPromptView.h"


@interface CustomPromptView ()
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (nonatomic,copy) void(^sureBllock)(void);
@property (weak, nonatomic) IBOutlet UILabel *titlLabel;

@end

@implementation CustomPromptView

- (void)awakeFromNib{
    [super awakeFromNib];
    self.bgView.layer.masksToBounds = YES;
    self.bgView.layer.cornerRadius = 10.f;
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
    }
    return self;
}
+(CustomPromptView *)showPromptViewSureBlcok:(void(^)(void))sureBlcok{
    CustomPromptView *customPromptView = [CustomPromptView loadFromNibWithFrame:kScreenBounds];
    customPromptView.sureBllock =sureBlcok;
    [kKeyWindow addSubview:customPromptView];
    return customPromptView;
}

+(CustomPromptView *)showPromptViewTitle:(NSString *)title sureBlcok:(void(^)(void))sureBlcok;{
    CustomPromptView *customPromptView =  [self showPromptViewSureBlcok:sureBlcok];
    customPromptView.titlLabel.text = title;
    return customPromptView;
    
}
- (IBAction)cancleBtnAction:(id)sender {
    [self removeFromSuperview];
}
- (IBAction)sureBtnAction:(id)sender {
    [self removeFromSuperview];

    if (self.sureBllock) {
        self.sureBllock();
    }
}


@end
